package cn.kooki.app.duobao.ui.Adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;

import java.util.ArrayList;
import java.util.List;

import butterknife.Bind;
import butterknife.ButterKnife;
import cn.kooki.app.duobao.R;

/**
 * Created by xiong on 2015/12/17.
 */
public class ShareFragmentAdapter extends BaseAdapter {

    private final Context context;
    private List<String> datas = new ArrayList<>();

    public ShareFragmentAdapter(Context context, List<String> datas) {
        this.context = context;
        this.datas = datas;
    }

    @Override
    public int getCount() {
        return datas.size();
    }

    @Override
    public Object getItem(int position) {
        return null;
    }

    @Override
    public long getItemId(int position) {
        return 0;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        ViewHolder viewHolder = null;
        if (convertView == null) {
            convertView = LayoutInflater.from(context).inflate(R.layout.layout_share_activity_item, parent, false);
            viewHolder = new ViewHolder(convertView);
            convertView.setTag(viewHolder);
        } else {
            viewHolder = (ViewHolder) convertView.getTag();
        }


        return convertView;
    }


    /**
     * This class contains all butterknife-injected Views & Layouts from layout file 'layout_share_activity_item.xml'
     * for easy to all layout elements.
     *
     * @author ButterKnifeZelezny, plugin for Android Studio by Avast Developers (http://github.com/avast)
     */
    static class ViewHolder {
        @Bind(R.id.share_list_item_icon)
        ImageView shareListItemIcon;
        @Bind(R.id.share_list_item_title)
        TextView shareListItemTitle;
        @Bind(R.id.share_list_item_content)
        TextView shareListItemContent;
        @Bind(R.id.more_icon)
        ImageView moreIcon;

        ViewHolder(View view) {
            ButterKnife.bind(this, view);
        }
    }
}
